package java111_2;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Day33 {
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        long tmp = 1;
        long res = tmp << (n-1);
        System.out.println(res);
        // System.out.println(1 << (new Scanner(System.in).nextInt() - 1));
    }



    public static void main2(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.next();
        int count = 0, res = 0;
        int[] arr = new int[26];
        for(int left = 0, right = 0; right < str.length(); right++){
            count = arr[str.charAt(right) - 'a']++ == 0 ? count + 1 : count;
            while(count > 2){
                count = --arr[str.charAt(left++) - 'a'] == 0 ? count - 1 : count;
            }
            res = Math.max(res, right-left+1);
        }
        System.out.println(res);
    }



    public static void main(String[] args) {

        Set<Integer> set = new HashSet<>();
        ArrayList<Integer> list = new ArrayList<>(set);
    }
}
